From: Florian Müllner Date: Tue, 2 Dec 2025 14:32:16 +0000 (+0100) Subject: js: Stop wrapping ease() in promise X-Git-Tag: archive/raspbian/50.5-1+rpi1~1^2~44^2~30 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=04cab9ee9e03720c1da819f2a25b0af954f99460;p=gnome-shell.git js: Stop wrapping ease() in promise We can now use the async variants instead. Part-of: --- diff --git a/js/ui/layout.js b/js/ui/layout.js index 06afaa2aa..d415e595d 100644 --- a/js/ui/layout.js +++ b/js/ui/layout.js @@ -16,6 +16,8 @@ import * as Main from './main.js'; import * as Params from '../misc/params.js'; import * as Ripples from './ripples.js'; +import {logErrorUnlessCancelled} from '../misc/errorUtils.js'; + export const STARTUP_ANIMATION_TIME = 500; export const BACKGROUND_FADE_ANIMATION_TIME = 1000; @@ -775,30 +777,24 @@ export const LayoutManager = GObject.registerClass({ } async _startupAnimationGreeter() { - await new Promise(resolve => { - this.panelBox.ease({ - translation_y: 0, - duration: STARTUP_ANIMATION_TIME, - mode: Clutter.AnimationMode.EASE_OUT_QUAD, - onStopped: () => resolve(), - }); - }); + await this.panelBox.easeAsync({ + translation_y: 0, + duration: STARTUP_ANIMATION_TIME, + mode: Clutter.AnimationMode.EASE_OUT_QUAD, + }).catch(logErrorUnlessCancelled); } async _startupAnimationSession() { if (Main.sessionMode.hasOverview) { await Main.overview.runStartupAnimation(); } else { - await new Promise(resolve => { - this.uiGroup.ease({ - scale_x: 1, - scale_y: 1, - opacity: 255, - duration: STARTUP_ANIMATION_TIME, - mode: Clutter.AnimationMode.EASE_OUT_QUAD, - onStopped: () => resolve(), - }); - }); + await this.uiGroup.easeAsync({ + scale_x: 1, + scale_y: 1, + opacity: 255, + duration: STARTUP_ANIMATION_TIME, + mode: Clutter.AnimationMode.EASE_OUT_QUAD, + }).catch(logErrorUnlessCancelled); } } diff --git a/js/ui/messageList.js b/js/ui/messageList.js index c745acbc2..170ba5e8a 100644 --- a/js/ui/messageList.js +++ b/js/ui/messageList.js @@ -16,6 +16,7 @@ import * as Mpris from './mpris.js'; import * as Util from '../misc/util.js'; import {formatTimeSpan} from '../misc/dateUtils.js'; +import {logErrorUnlessCancelled} from '../misc/errorUtils.js'; const MAX_NOTIFICATION_BUTTONS = 3; export const MESSAGE_ANIMATION_TIME = 100; @@ -979,13 +980,10 @@ export const NotificationMessageGroup = GObject.registerClass({ this.notify('expanded'); this._cover.hide(); - await new Promise((resolve, _) => { - this.ease_property('@layout.expansion', 1, { - progress_mode: Clutter.AnimationMode.EASE_OUT_QUAD, - duration: GROUP_EXPENSION_TIME, - onComplete: () => resolve(), - }); - }); + await this.ease_property_async('@layout.expansion', 1, { + progress_mode: Clutter.AnimationMode.EASE_OUT_QUAD, + duration: GROUP_EXPENSION_TIME, + }).catch(logErrorUnlessCancelled); } async collapse() { @@ -1003,13 +1001,10 @@ export const NotificationMessageGroup = GObject.registerClass({ this._cover.show(); this._updateStackedMessagesFade(); - await new Promise((resolve, _) => { - this.ease_property('@layout.expansion', 0, { - progress_mode: Clutter.AnimationMode.EASE_OUT_QUAD, - duration: GROUP_EXPENSION_TIME, - onComplete: () => resolve(), - }); - }); + await this.ease_property_async_async('@layout.expansion', 0, { + progress_mode: Clutter.AnimationMode.EASE_OUT_QUAD, + duration: GROUP_EXPENSION_TIME, + }).catch(logErrorUnlessCancelled); this._headerBox.hide(); } diff --git a/js/ui/overviewControls.js b/js/ui/overviewControls.js index 478318bd5..135168194 100644 --- a/js/ui/overviewControls.js +++ b/js/ui/overviewControls.js @@ -806,13 +806,11 @@ class ControlsManager extends St.Widget { const startupPromises = []; this._stateAdjustment.value = ControlsState.HIDDEN; - startupPromises.push(new Promise(resolve => { - this._stateAdjustment.ease(ControlsState.WINDOW_PICKER, { + startupPromises.push( + this._stateAdjustment.easeAsync(ControlsState.WINDOW_PICKER, { duration: Overview.ANIMATION_TIME, mode: Clutter.AnimationMode.EASE_OUT_QUAD, - onStopped: resolve, - }); - })); + })); this.dash.showAppsButton.checked = false; this._ignoreShowAppsButtonToggle = false; @@ -824,14 +822,12 @@ class ControlsManager extends St.Widget { await this.layout_manager.ensureAllocation(); // Opacity - startupPromises.push(new Promise(resolve => { - this.ease({ + startupPromises.push( + this.easeAsync({ opacity: 255, duration: STARTUP_ANIMATION_TIME, mode: Clutter.AnimationMode.EASE_OUT_QUAD, - onStopped: resolve, - }); - })); + })); // Search bar falls from the ceiling const {primaryMonitor} = Main.layoutManager; @@ -839,27 +835,23 @@ class ControlsManager extends St.Widget { const yOffset = y - primaryMonitor.y; this._searchEntryBin.translation_y = -(yOffset + this._searchEntryBin.height); - startupPromises.push(new Promise(resolve => { - this._searchEntryBin.ease({ + startupPromises.push( + this._searchEntryBin.easeAsync({ translation_y: 0, duration: STARTUP_ANIMATION_TIME, mode: Clutter.AnimationMode.EASE_OUT_QUAD, - onStopped: resolve, - }); - })); + })); // The Dash rises from the bottom. This is the last animation to finish, // so resolve the promise there. this.dash.translation_y = this.dash.height + this.dash.margin_bottom; - startupPromises.push(new Promise(resolve => { - this.dash.ease({ + startupPromises.push( + this.dash.easeAsync({ translation_y: 0, delay: STARTUP_ANIMATION_TIME, duration: STARTUP_ANIMATION_TIME, mode: Clutter.AnimationMode.EASE_OUT_QUAD, - onStopped: () => resolve(), - }); - })); + })); return Promise.allSettled(startupPromises); }